<!-- 城市地铁管理 -->
<template>
  <div class>
    <div class="title-info">
      <div>推荐客户id：{{row.clientCode}}</div>
      <div>客户名称：{{row.customerName}}</div>
      <div>客户手机号：{{row.customerPhone}}</div>
    </div>
    <table-list
      :tableData="tableData"
      :tableInfos="tableInfos"
      :tableFormatter="tableFormatter"
      :hasSera="true"
    ></table-list>
    <el-pagination
      layout="total, sizes, prev, pager, next, jumper"
      style="margin-top:30px"
      :current-page.sync="pageNum"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :total="totalSize"
    ></el-pagination>
  </div>
</template>
<script>
import api from "@/api/apiPath";
import tableList from "@/components/common/tableList";
export default {
  name: "outInsuranceConfigRecord",
  title: "接收记录",
  components: {
    "table-list": tableList
  },
  data() {
    return {
      tableData: [],
      row: {},
      pageNum: 1,
      pageSize: 10, //每页几条
      totalSize: 0,
      tableInfos: [
        { label: "成交状态", prop: "status" },
        { label: "明源id", prop: "roomGUID" },
        { label: "房屋总价(元)", prop: "houseTotal", type: "money" },
        { label: "成交价(元)", prop: "total", type: "money" },
        { label: "楼盘", prop: "projName" },
        { label: "房间号", prop: "roomCode" },
        { label: "户型", prop: "huXing" },
        { label: "建筑面积(m²)", prop: "bldArea", type: "num" },
        { label: "套内面积(m²)", prop: "tnArea", type: "num" },
        { label: "跟进更新时间", prop: "time", type: "time" }
      ]
    };
  },
  methods: {
    searchList(pageNum) {
      //return;
      this.pageNum = pageNum || this.pageNum;
      let param = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        clientCode: this.row.clientCode
      };
      this.$axios
        .post("/forcrm/out/push/customerOutLogCustomerList", param)
        .then(res => {
          this.tableData = res.list;
          this.totalSize = res.total;
        });
    },
    init() {
      this.tableData = [];
      this.searchList(1);
    },
    tableFormatter(prop, val) {
      if (prop == "status") {
        let statusMap = {
          5: "已到访",
          4: "未到访",
          7: "已认购",
          8: "已签约",
          9: "已过期",
          14: "推荐无效",
          12: "已退房",
          13: "已退房"
        };
        return statusMap[val];
      }
      return val;
    },
    handleCurrentChange() {
      this.searchList();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.searchList(1);
    }
  },
  created() {
    this.row = this.$route.params.row;
    this.searchList(1);
  },
  activated() {
    let row = this.$route.params.row;
    row && (this.row = row);
    this.searchList();
  },
  destroyed() {},
  filters: {}
};
</script>

<style lang="stylus" scoped>
.title-info {
  margin: 20px 0;
  display: flex;
  font-size: 14px;
  color: #666;

  >div {
    width: 33%;
    padding-right: 10px;
  }
}
</style>
